package mobileann.mafamily.utils;


import mobileann.mafamily.adapter.MallGoodsAdapter.ViewHolder;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.text.TextUtils;

public class ImageLoadTask extends AsyncTask<Object, Void, Bitmap>{
    private ViewHolder mHolder;  
    private String url;
    @Override
    protected Bitmap doInBackground(Object... params) {
	mHolder = (ViewHolder) params[0];  
        url = (String) params[1];  
        int position = (Integer) params[2];  
        Bitmap drawable = CoinMallUtils.getInstance().loadImage(url);//获取网络图片  
        return drawable;  
    }
    @Override
    protected void onPostExecute(Bitmap result) {
        if (result == null) {  
            return;  
        }  
        mHolder.iv_coinmall_goodsicon.setImageBitmap(result);
        String urlsStr=CoinMallUtils.getInstance().getImgName(url);
        if(!TextUtils.isEmpty(urlsStr)){
            CoinMallUtils.getInstance().saveImgToSD(urlsStr ,result);
        }
    }
}
